package com.zbw.common.controller;

import com.zbw.common.entity.News;
import com.zbw.common.service.IndexCacheService;
import com.zbw.common.vo.BookSettingVO;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping(path = {"/", "/index", "/index.html"})
@RequiredArgsConstructor
@Slf4j
public class IndexController {

    private final IndexCacheService indexCacheService;



    @RequestMapping("indexcache")
    public Map<Byte, List<BookSettingVO>> listBooksCache(){

        return indexCacheService.listIndex();
    }

    @RequestMapping("newList")
    public List<News> newLists(){

        return indexCacheService.listIndexNews();
    }
}
